﻿@model Whoever.Health.Website.Models.GridTestModels.PruebaModel
@{
    ViewBag.Title = "Index";
}
<style type="text/css">
ul {
    float:left;
    clear:right;
    padding:20px;
    list-style-type: none;

}

li {
    list-style-type: none;
    float:left;
    clear:left;
}
</style>

<h2>Index</h2>

<div class="jumbotron color-white">
    <div class="row">
        <div class="col-md-12">
            @using (Html.BeginForm("Create", "Contact", FormMethod.Post, new { id = "create"}))
            { 
                <pre data-bind='text: ko.computed(function() { debugger; })'></pre>
                @Html.WhoGrid(u => u.contacts, "pruebaModelList")
            }
        
        </div>
    </div>
</div>
@section Scripts{
<script type="text/javascript">
    $(document).ready(function () {

        var pruebaModel = function (data) {
            var pruebaModelItem = {
                Id: ko.observable(data.Id),
                Name: ko.observable(data.Name),
                Surname: ko.observable(data.Surname),
                Description : ko.observable(data.Description),
                WebsiteURL : ko.observable(data.WebsiteURL),
                CompanyName : ko.observable(data.CompanyName),
                Since : ko.observable(data.Since)
            };
            return pruebaModelItem;
        };

        var model =  {
            prueba: pruebaModel
        };

        model.Main = mainViewModel;
        model.Main.Hashes.push("Start");
        model.Main.CurrentPage("Start");
        Sammy().run();

        model.pruebaModelList = ko.observableArray(ko.utils.arrayMap(@Html.Raw(Model.contacts.ToJson()), function (data) {
            return new pruebaModel(data);
        }));

        ko.applyBindings(model);
    });

</script>
    }